home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / AEbevelPlusTemplate.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  10.1 KB  |  312 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //    Alias|Wavefront Script File
  19. //
  20. //    Creation Date:    April 1, 2001
  21. //
  22. //
  23. //    Procedure Name:
  24. //    AEbevelPlusTemplate
  25. //
  26. //    Description Name;
  27. //    Creates the attribute editor controls for the bevel plus node
  28. //
  29. //    Input Value:
  30. //    nodeName
  31. //
  32. //    Output Value:
  33. //    None
  34. //
  35.  
  36. global proc AEbpFormatControls( string $nodeName )
  37. {
  38.     string $formatAttrName = $nodeName + ".outputPoly";
  39.     string $connections[] = `listConnections $formatAttrName`;
  40.  
  41.     if (size($connections) == 0) {
  42.         // If the output type is not polys,
  43.         // dim all the poly-related controls.
  44.         editorTemplate -dimControl $nodeName "polyOutMethod" true;
  45.         editorTemplate -dimControl $nodeName "polyOutCount" true;
  46.  
  47.         editorTemplate -dimControl $nodeName "polyOutExtrusionType" true;
  48.         editorTemplate -dimControl $nodeName "polyOutExtrusionSamples" true;
  49.         editorTemplate -dimControl $nodeName "polyOutCurveType" true;
  50.         editorTemplate -dimControl $nodeName "polyOutCurveSamples" true;
  51.         editorTemplate -dimControl $nodeName "polyOutUseChordHeight" true;
  52.         editorTemplate -dimControl $nodeName "polyOutChordHeight" true;
  53.         editorTemplate -dimControl $nodeName "polyOutUseChordHeightRatio" true;
  54.         editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" true;
  55.         editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" true;
  56.     } else {
  57.         editorTemplate -dimControl $nodeName "polyOutMethod" false;
  58.  
  59.         $formatAttrName = $nodeName + ".polyOutMethod";
  60.         int $value = `getAttr $formatAttrName`;
  61.  
  62.         if ( $value == 0 )
  63.         {
  64.             // face count
  65.             editorTemplate -dimControl $nodeName "polyOutCount" false;
  66.  
  67.             editorTemplate -dimControl $nodeName "polyOutExtrusionType" true;
  68.             editorTemplate -dimControl $nodeName "polyOutExtrusionSamples" true;
  69.             editorTemplate -dimControl $nodeName "polyOutCurveType" true;
  70.             editorTemplate -dimControl $nodeName "polyOutCurveSamples" true;
  71.             editorTemplate -dimControl $nodeName "polyOutUseChordHeight" true;
  72.             editorTemplate -dimControl $nodeName "polyOutChordHeight" true;
  73.             editorTemplate -dimControl $nodeName "polyOutUseChordHeightRatio" true;
  74.             editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" true;
  75.             editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" true;
  76.         }
  77.         else
  78.         {
  79.             // sampling
  80.             editorTemplate -dimControl $nodeName "polyOutExtrusionType" false;
  81.             editorTemplate -dimControl $nodeName "polyOutExtrusionSamples" false;
  82.             editorTemplate -dimControl $nodeName "polyOutCurveType" false;
  83.             editorTemplate -dimControl $nodeName "polyOutCurveSamples" false;
  84.             editorTemplate -dimControl $nodeName "polyOutUseChordHeight" false;
  85.             editorTemplate -dimControl $nodeName "polyOutChordHeight" false;
  86.             editorTemplate -dimControl $nodeName "polyOutUseChordHeightRatio" 0;
  87.             editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" false;
  88.             editorTemplate -dimControl $nodeName "polyOutCount" true;
  89.  
  90.             AEbpUseChordHeightControls( $nodeName );
  91.             AEbpUseChordHeightRatioControls( $nodeName );
  92.         }
  93.     }
  94. }
  95.  
  96. global proc AEbpUseChordHeightControls( string $nodeName )
  97. {
  98.     string $useChordHeightAttrName = $nodeName + ".polyOutUseChordHeight";
  99.     int $useChordHeightValue = `getAttr $useChordHeightAttrName`;
  100.  
  101.     if ( $useChordHeightValue == 0 )
  102.     {
  103.         editorTemplate -dimControl $nodeName "polyOutChordHeight" true;
  104.     }
  105.     else
  106.     {
  107.         editorTemplate -dimControl $nodeName "polyOutChordHeight" false;
  108.     }
  109. }
  110.  
  111. global proc AEbpUseChordHeightRatioControls( string $nodeName )
  112. {
  113.     string $formatAttrName = $nodeName + ".polyOutMethod";
  114.     int $formatValue = `getAttr $formatAttrName`;
  115.     string $useChordHeightRatioAttrName = $nodeName + ".polyOutUseChordHeightRatio";
  116.     int $useChordHeightRatioValue = `getAttr $useChordHeightRatioAttrName`;
  117.  
  118.     if ( $useChordHeightRatioValue == 0 && $formatValue == 2 )
  119.     {
  120.         editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" true;
  121.     }
  122.     else
  123.     {
  124.         editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" false;
  125.     }
  126. }
  127.  
  128. global proc AEbpSideCheckBoxChange(string $bevelCheckBoxGrp, string $attr)
  129. {
  130.     int $side, $start, $end;
  131.     $start = `checkBoxGrp -query -value1 $bevelCheckBoxGrp`;
  132.     $end   = `checkBoxGrp -query -value2 $bevelCheckBoxGrp`;
  133.     
  134.     if ($start && $end) $side = 4;
  135.     else if ($start && !$end) $side = 2;
  136.     else if (!$start && $end) $side = 3;
  137.     else $side = 1;
  138.     
  139.     setAttr $attr $side;
  140. }
  141.  
  142. global proc AEbpSideNew( string $attributeUIName, string $attr)
  143. {
  144.     string $bevelCheckBox = "AEbpCheckBoxGrp" + $attributeUIName;
  145.  
  146.     checkBoxGrp -numberOfCheckBoxes 2
  147.         -label $attributeUIName
  148.         -labelArray2 "At Start" "At End"
  149.         -changeCommand("AEbpSideCheckBoxChange " + $bevelCheckBox + " " + $attr)
  150.         $bevelCheckBox;
  151.  
  152.     AEbpSideReplace($attributeUIName, $attr);
  153. }
  154.  
  155. global proc AEbpSideReplace ( string $attributeUIName, string $attr )
  156. {
  157.     string $bevelCheckBox = "AEbpCheckBoxGrp" + $attributeUIName;
  158.  
  159.     int $side = `getAttr $attr`;
  160.     int $start, $end;
  161.     
  162.     if (1 == $side) {
  163.         $start = false;
  164.         $end = false;
  165.     } else if (2 == $side) {
  166.         $start = true;
  167.         $end = false;
  168.     } else if (3 == $side) {
  169.         $start = false;
  170.         $end = true;
  171.     } else {
  172.         $start = true;
  173.         $end = true;
  174.     }
  175.     
  176.     checkBoxGrp -edit -valueArray2 $start $end $bevelCheckBox;
  177.     checkBoxGrp -edit -changeCommand
  178.         ("AEbpSideCheckBoxChange " + $bevelCheckBox + " " + $attr)
  179.         $bevelCheckBox;
  180.     checkBoxGrp -edit -enable true $bevelCheckBox;
  181. }
  182.  
  183. global proc AEbpCapSideNew( string $attributeUIName ,  string $attr )
  184. {
  185.     string $bevelCheckBox = "AEbpCheckBoxGrp" + $attributeUIName;
  186.  
  187.     checkBoxGrp -numberOfCheckBoxes 2
  188.         -label $attributeUIName
  189.         -labelArray2 "At Start" "At End"
  190.         -changeCommand("AEbpSideCheckBoxChange " + $bevelCheckBox + " " + $attr)
  191.         $bevelCheckBox;
  192.         
  193.     AEbpCapSideReplace($attributeUIName, $attr);
  194. }
  195.  
  196. proc int AEbpCapSideVisible( string $attr )
  197. //
  198. // Description:
  199. //     Only allow the cap option in the attribute editor when
  200. //     we have polys.  Otherwise, the number of surfaces changes.
  201. {
  202.     string $opa = `substitute "capSides" $attr "outputPoly"`;
  203.     string $opc[] = `listConnections $opa`;
  204.     int $vis = false;
  205.     if( size($opc) > 0 ) $vis = true;
  206.     return $vis;
  207. }
  208.  
  209. global proc AEbpCapSideReplace ( string $attributeUIName, string $attr )
  210. {
  211.     string $bevelCheckBox = "AEbpCheckBoxGrp" + $attributeUIName;
  212.     int $vis = `AEbpCapSideVisible $attr`;
  213.  
  214.     if( $vis ) {
  215.         int $side = `getAttr $attr`;
  216.         int $start, $end;
  217.     
  218.         if (1 == $side) {
  219.             $start = false;
  220.             $end = false;
  221.         }
  222.         else if (2 == $side) {
  223.             $start = true;
  224.             $end = false;
  225.         }
  226.         else if (3 == $side) {
  227.             $start = false;
  228.             $end = true;
  229.         }
  230.         else {
  231.             $start = true;
  232.             $end = true;
  233.         }
  234.         checkBoxGrp -edit -valueArray2 $start $end $bevelCheckBox;
  235.         checkBoxGrp -edit -changeCommand
  236.             ("AEbpSideCheckBoxChange " + $bevelCheckBox + " " + $attr)
  237.             $bevelCheckBox;
  238.     }
  239.     checkBoxGrp -edit -visible $vis $bevelCheckBox;
  240. }
  241.  
  242. global proc AEbevelPlusTemplate( string $nodeName )
  243. {
  244.     editorTemplate -beginScrollLayout;
  245.  
  246.         editorTemplate -beginLayout "Bevel Plus History" -collapse false;
  247.             editorTemplate -callCustom
  248.                         "AEinputNew     \"Input Curves\""
  249.                         "AEinputReplace \"Input Curves\""
  250.                         "inputCurves";
  251.  
  252.             editorTemplate -callCustom
  253.                         "AEbpSideNew     \"Bevel\""
  254.                         "AEbpSideReplace \"Bevel\""
  255.                         "numberOfSides";
  256.  
  257.             editorTemplate -label "Bevel Width" -addControl "width";
  258.             editorTemplate -label "Bevel Depth"-addControl "depth";
  259.             editorTemplate -label "Extrude Distance" -addControl "extrudeDepth";
  260.  
  261.             editorTemplate -callCustom
  262.                 "AEbpCapSideNew     \"Cap\""
  263.                 "AEbpCapSideReplace \"Cap\""
  264.                 "capSides";
  265.  
  266.             editorTemplate -callCustom
  267.                         "AEinputNew     \"Outer Style Curve\""
  268.                         "AEinputReplace \"Outer Style Curve\""
  269.                         "outerStyleCurve";
  270.  
  271.             editorTemplate -callCustom
  272.                         "AEinputNew     \"Inner Style Curve\""
  273.                         "AEinputReplace \"Inner Style Curve\""
  274.                         "innerStyleCurve";
  275.  
  276.             editorTemplate -addControl "tolerance";
  277.  
  278.         editorTemplate -endLayout;
  279.     
  280.         editorTemplate -beginLayout "Polygon Output Options" -collapse true;
  281.             editorTemplate -label "Method" -addControl "polyOutMethod" "AEbpFormatControls";
  282.             editorTemplate -beginLayout "Sampling" -collapse false;
  283.                 editorTemplate -label " " -addControl "polyOutExtrusionType";
  284.                 editorTemplate -label " " -addControl "polyOutExtrusionSamples";
  285.                 editorTemplate -label " " -addControl "polyOutCurveType";
  286.                 editorTemplate -label " " -addControl "polyOutCurveSamples";
  287.  
  288.                 editorTemplate -label "Use Chord Height" -addControl "polyOutUseChordHeight" "AEbpUseChordHeightControls";
  289.                 editorTemplate -label "Chord Height " -addControl "polyOutChordHeight";
  290.                 editorTemplate -label "Use Chord Height Ratio" -addControl "polyOutUseChordHeightRatio" "AEbpUseChordHeightRatioControls";
  291.                 editorTemplate -label "Chord Height Ratio" -addControl "polyOutChordHeightRatio";
  292.             editorTemplate -endLayout;
  293.  
  294.             editorTemplate -beginLayout "Count" -collapse false;
  295.                 editorTemplate -label "Count" -addControl "polyOutCount";
  296.             editorTemplate -endLayout;
  297.  
  298.         editorTemplate -endLayout;
  299.  
  300.         //suppressed attributes
  301.         editorTemplate -suppress "inputCurves";
  302.         editorTemplate -suppress "outerStyleCurve";
  303.         editorTemplate -suppress "innerStyleCurve";
  304.         editorTemplate -suppress "polygonType";
  305.  
  306.         // include/call base class/node attributes
  307.         AEdependNodeTemplate $nodeName;
  308.  
  309.     editorTemplate -addExtraControls;
  310.     editorTemplate -endScrollLayout;
  311. }
  312.